This page last changed on Aug 08, 2007 by aaime.

FeatureType

The final piece of the configuration puzzle is to set up your FeatureType. Our use of the term FeatureType betrays our WFS roots, in WMS speak it is called a layer. But configuration for both is done in the FeatureType section. It represents a number of features that have the same types of properties, both geometric and non-geometric attributes. As we said earlier, it generally represents a table in a database, or a single file. Since you have already configured all the connection parameters in the DataStore section, the FeatureType configuration is mostly meta information, along with setting how you would like to expose the attributes of the table. To create a FeatureType click on the FeatureType link and you will be taken to a page like the following:

From here you can select a FeatureType to edit from the drop downbox, or you can create a new one. GeoServer comes with several shapefile FeatureTypes by default, you can edit them if you would like, and should delete them if this is a public instance. To create a new one click on the 'New' button, and you will be taken to a page like this:

From here you select the FeatureType to edit. The drop down list will show all the possible FeatureTypes for the DataStores you have configured. If you have a database with many tables then there will be many options to select from. Note that for now we only allow you to select the names of the FeatureTypes as they appear in the backend data type. In the future we will likely allow you to configure them to a name you want. So select the FeatureType you would like to create and hit 'New'. This will take you to the FeatureType Editor page. Note that in the future you can get here by just selecting your FeatureType from the main FeatureType page and hitting 'Edit'

On this page you should fill out as much information as possible. The Style is a drop down list of the available styles that are configured for GeoServer. This just selects the default style, which is the one that will return in a WMS request for this layer when no style is explicitly named. It also appears in the WMS capabilities document. Other styles are also available for the layer, you just have to know their name to request them. If you have lines or polygons then the normal style is a good default, as it just draws a black line.

The SRS (Spatial Reference System) should be an EPSG code. This is the projection that your data is stored in. Some datastores, like PostGIS can automatically detect it. If you do not know the SRS than you can use 4326 (lat/long) to just get something on the screen, but you should really try hard to get the right SRS in place, since data reprojection as well as scale computation depend on it being properly set. More informations on how to handle the SRS options can be found in this specific tutorial.

Related to the SRS is the Bounding Box. This should be in Latitude and Longitude; it is reported in the capabilities document so clients will know approximately where in the world the layer is located. If you have properly defined your SRS, then GeoServer can automatically calculate it for you with the 'Generate' button. It does not need to be exact, just an approximation. You should replace the generated Keywords, Abstract, and Title, with more relevant information about your FeatureType.

By default GeoServer just generates the attributes based exactly on the back end data format. But a little known (and even less advertised since it was kind of broken up until 1.2.4) feature is that you actually can customize your attributes from the FeatureType Editor page. We still need to make it a bit more intuitive, but to launch the attribute editor you just change the Schema Base from '-' to gml:AbstractFeatureType'(select it from the drop down list and hit change). Unfortunately we do not have a good picture at the moment, but try it out. You will be given a new user interface. You can change the order that your attributes appear in, moving them up or down. You can also delete them (with the X button), effectively 'hiding' those attributes from the user. And you can change minOccurs to 1, which will ensure that the feature is always returned, since it must be present for the xml to be valid. The nilleable check box does not really do anything at the moment, except appear in the DescribeFeatureType response.

You will also notice that you can select the type of each attribute. We have not yet checked all of these for validity, and recommend going with the default. But also note the (xml fragment) option. This allows you to completely customize the attribute - whatever you write in that field is exactly what is returned to the user. You can even do complex imports and other XML tricks. Just be sure to make sure it validates, since configuring in this way gives you completely control, but also gives you all the responsibility. Also note that you can completely write your own schema.xml file, if configuring each attribute is not sufficient for you. See the developers page on working with files for more information.

One last thing to mention, there is a little bug that should be fixed in the next release. If you are doing the customization of attributes then a simply 'Apply" will not get them to show up. To have the new schema that you created return in the DescribeFeatureType response you must also 'Save' and then 'Load', or else restart GeoServer.

After you have configured your FeatureType, be sure to hit Submit, and then do the normal save procedure.


featuretype-editor.jpg (image/jpeg)
featuretype-new.jpg (image/jpeg)
featuretype.jpg (image/jpeg)
Document generated by Confluence on Jan 16, 2008 23:27